<?php

define('WSDL_FILE', 'ts2.wsdl');

try {
    if (!file_exists(WSDL_FILE)) {
        require_once 'SoapDiscovery.class.php';
        $sd  = new SoapDiscovery('testD', 'liang');
        $str = $sd->getWSDL();
        // var_dump($str);
        file_put_contents(WSDL_FILE, $str);
    }
} catch (Exception $e) {
    var_dump($e);
}

// exit();

$ss = new SoapServer(WSDL_FILE);
$ss->setClass('testD');
$ss->handle();

class testD
{
    public function sayHello($world)
    {
        return 'hello,' . $world;
    }

    public function add($a, $b)
    {
        return $a + $b;
    }
}
